import { ecs } from "db://app-game/libs/ecs/ECS";
import { DBLevel } from "../../../common/db/db-level/DBLevel";
import { DBLevelType } from "../../../common/db/db-level/DBLevel.type";

/** 关卡基础数据 */
@ecs.register("LevelBaseModel")
export class LevelBaseModelComp extends ecs.Comp {
  private db: DBLevel = new DBLevel();
  private _id: number = -1;
  /** 关卡id */
  get id(): number {
    return this._id;
  }
  set id(value: number) {
    this._id = value;
    this.db.init(value);
    this.data = this.db.data;
  }

  /** 关卡基础数据 */
  public data: DBLevelType = null!;

  reset(entity: ecs.Entity): void {
    this._id = -1;
    this.data = null!;
  }
}
